# Maintainer: David Runge <dvzrv@archlinux.org>

pkgname=mephisto.lv2
pkgver=0.18.2
pkgrel=3
pkgdesc="A Just-in-Time FAUST compiler embedded in an LV2 plugin"
arch=(loong64 x86_64)
url="https://git.open-music-kontrollers.ch/~hp/mephisto.lv2"
license=(Artistic2.0)
groups=(
  lv2-plugins
  pro-audio
)
depends=(
  glibc
  libglvnd
  libvterm
  libx11
  lv2-host
  ttf-fira-code
  ttf-fira-sans
)
makedepends=(
  faust
  fontconfig
  glew
  glu
  lv2
  meson
)
checkdepends=(lv2lint)
source=(
  $pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz
  $pkgname-$pkgver.tar.gz.asc::$url/archive/$pkgver.tar.gz.asc
)
sha512sums=('859ad1abd6bb3b41c7e9296a983c47478f2d30715cbc3230bf05fcb07b324a491b980781d44db15206032d62bf49013568801f0247ece29dfa25971b0a5a32e0'
            'SKIP')
b2sums=('e9668ebb1899c5c507fa9bcd498ba8160f6955c3f5131422a10c6a6075de674af546d85090142797f2fbc02490b0a6837de2f970141bf8b0c0f7db572ad749e8'
        'SKIP')
validpgpkeys=('5AE26CEBBF49705C19FB273A30258F99258CB76A') # Hanspeter Portner <dev@open-music-kontrollers.ch>

build() {
  arch-meson build $pkgname-$pkgver
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  depends+=(
    glew libGLEW.so
    faust libfaust.so
    fontconfig libfontconfig.so
  )

  meson install -C build --destdir "$pkgdir"
  # devendor ttf-fira-code
  rm -vf "$pkgdir/usr/lib/lv2/$pkgname/"*.ttf
  for font_type in {Bold,Light,Medium,Regular}; do
    ln -svf /usr/share/fonts/TTF/FiraCode-$font_type.ttf "$pkgdir/usr/lib/lv2/$pkgname/"
  done
  install -vDm 644 $pkgname-$pkgver/{ChangeLog,README.md} -t "$pkgdir/usr/share/doc/$pkgname/"
}
